package com.oocl.ita.winton.weibodate.jms;

import java.util.Queue;
import java.util.concurrent.BlockingQueue;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import com.oocl.ita.winton.modle.NeedReplyMessage;


public class QueueMessageListener implements MessageListener{
	BlockingQueue<NeedReplyMessage> messageQueue;
	@Override
	public void onMessage(Message msg) {
		TextMessage tm = (TextMessage)msg;
		try {
			messageQueue.add(new NeedReplyMessage(tm.getText(), tm.getJMSCorrelationID()));
		} catch (JMSException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	/**
	 * @return the weiboQueue
	 */
	public Queue<NeedReplyMessage> getQueue() {
		return messageQueue;
	}
	/**
	 * @param weiboQueue the weiboQueue to set
	 */
	public void setMessageQueue(BlockingQueue<NeedReplyMessage> Queue) {
		this.messageQueue = Queue;
	}
	

}
